bitkeeper revision 1.1236.1.124 (42429eb8uGingMvF7MF3Py6CUzFBzA)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 24 Mar 2005 11:04:24 +0000 (11:04 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 24 Mar 2005 11:04:24 +0000 (11:04 +0000)
NMI watchdog hooks off ac_timer softirq rather than apic timer irq.
In extreme situations we may service ac_timer events without ever
actually taking an apic interrupt.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/apic.c
xen/arch/x86/nmi.c
xen/common/ac_timer.c
xen/include/asm-x86/apic.h
xen/include/xen/ac_timer.h

index aa8907e0bae1ae7ccb75352f576202820ce5370e..49b51ba01226eca1e718f46d4fe825e57a1aaaa2 100644 (file)
@@ -722,15 +722,10 @@ int reprogram_ac_timer(s_time_t timeout)
     return 1;
 }
 
-unsigned int apic_timer_irqs [NR_CPUS];
-
 void smp_apic_timer_interrupt(struct xen_regs * regs)
 {
     ack_APIC_irq();
-
-    apic_timer_irqs[smp_processor_id()]++;
     perfc_incrc(apic_timer);
-
     raise_softirq(AC_TIMER_SOFTIRQ);
 }
 
index 0fa5968be488c5ff6609010c156b449fde25f999..89770b774a762e8a744709b7201784defe8ea440 100644 (file)
@@ -271,7 +271,7 @@ void nmi_watchdog_tick (struct xen_regs * regs)
 {
     int sum, cpu = smp_processor_id();
 
-    sum = apic_timer_irqs[cpu];
+    sum = ac_timers[cpu].softirqs;
 
     if ( (last_irq_sums[cpu] == sum) && watchdog_on )
     {
index 1f27ed7b08ec3e706a1d8605eb511a8145cf4347..4ffd4061fbe89ad958cd82033b5abbf0aa23387f 100644 (file)
 
 #define DEFAULT_HEAP_LIMIT 127
 
-/* A timer list per CPU */
-typedef struct ac_timers_st
-{
-    spinlock_t        lock;
-    struct ac_timer **heap;
-} __cacheline_aligned ac_timers_t;
-static ac_timers_t ac_timers[NR_CPUS];
-
+struct ac_timers ac_timers[NR_CPUS];
 
 /****************************************************************************
  * HEAP OPERATIONS.
@@ -214,6 +207,8 @@ static void ac_timer_softirq_action(void)
     s_time_t         now;
     void             (*fn)(unsigned long);
 
+    ac_timers[cpu].softirqs++;
+
     spin_lock_irq(&ac_timers[cpu].lock);
     
     do {
@@ -277,8 +272,10 @@ void __init ac_timer_init(void)
 
     for ( i = 0; i < smp_num_cpus; i++ )
     {
-        ac_timers[i].heap = xmalloc_array(struct ac_timer *, DEFAULT_HEAP_LIMIT+1);
-        if ( ac_timers[i].heap == NULL ) BUG();
+        ac_timers[i].heap = xmalloc_array(
+            struct ac_timer *, DEFAULT_HEAP_LIMIT+1);
+        BUG_ON(ac_timers[i].heap == NULL);
+
         SET_HEAP_SIZE(ac_timers[i].heap, 0);
         SET_HEAP_LIMIT(ac_timers[i].heap, DEFAULT_HEAP_LIMIT);
         spin_lock_init(&ac_timers[i].lock);
index 54289910ab2045bd962ef797975a62ead67519c0..403664ca37154b80e3e8f1c617683124300a16f5 100644 (file)
@@ -83,12 +83,7 @@ extern int APIC_init_uniprocessor (void);
 extern void disable_APIC_timer(void);
 extern void enable_APIC_timer(void);
 
-/*extern struct pm_dev *apic_pm_register(pm_dev_t, unsigned long, pm_callback);*/
-/*extern void apic_pm_unregister(struct pm_dev*);*/
-
 extern unsigned int watchdog_on;
-
-extern unsigned int apic_timer_irqs [NR_CPUS];
 extern int check_nmi_watchdog (void);
 
 extern unsigned int nmi_watchdog;
index 16e012ca104734bdb5618c2cc212a9d5f59c85a6..4f3cf9de9c5116efc6a30933ff3f7335090341f0 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef _AC_TIMER_H_
 #define _AC_TIMER_H_
 
+#include <xen/spinlock.h>
 #include <xen/time.h>
 
 struct ac_timer {
@@ -87,6 +88,13 @@ extern void mod_ac_timer(struct ac_timer *timer, s_time_t new_time);
 
 extern int reprogram_ac_timer(s_time_t timeout);
 
+struct ac_timers {
+    spinlock_t        lock;
+    struct ac_timer **heap;
+    unsigned int      softirqs;
+} __cacheline_aligned;
+extern struct ac_timers ac_timers[];
+
 #endif /* _AC_TIMER_H_ */
 
 /*